package com.zjs.jsp.fdservice.Help;

import com.zjs.jsp.domain.jsp.Jsp_Order;
import org.apache.commons.codec.digest.DigestUtils;

import java.util.List;
import java.util.UUID;

/**
 * 唯一标识生成
 *
 * @author 李文
 * @create 2017-09-01 16:43
 **/
public class OnlyDataHelp
{

    /**
     * 生成一个任务包唯一编码
     */
    public  String getWyString(List<Jsp_Order> jspOrders) {
        StringBuilder s = new StringBuilder();
        for (Jsp_Order jspOrder1 : jspOrders) {
            s.append(jspOrder1.getPoc());
        }
        String wy;
        try {
            wy = DigestUtils.md5Hex(s.toString().getBytes("UTF-8")).replace("-", "").toLowerCase();
        } catch (Exception e) {
            wy = UUID.randomUUID().toString().replace("-", "");
        }
        return wy;
    }
}
